//
//  HGMusicThreeCollectionViewCell.m
//  悦享
//
//  Created by dllo on 16/3/22.
//  Copyright © 2016年 张洪国. All rights reserved.
//

#import "HGMusicThreeCollectionViewCell.h"
#import <UIImageView+WebCache.h>
@implementation HGMusicThreeCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews{
    
    self.imageView1 = [[UIImageView alloc] init];
    [self.contentView addSubview:_imageView1];
    
    self.textLabel1 = [[UILabel alloc] init];
    [self.contentView addSubview:_textLabel1];
    
    self.nameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_nameLabel];
    
    self.backImage = [[UIImageView alloc] init];
    [self.contentView addSubview:_backImage];
    
}

- (void)setModel:(HGMusicDataModel *)model{
    
    _model = model;
    
    [_imageView1 sd_setImageWithURL:[NSURL URLWithString:_model.picUrl] placeholderImage:[UIImage imageNamed:PLACE_HLODER]];
    
    _backImage.image = [UIImage imageNamed:@"trip_edit_title_shadow@2x.png"];
    
    _nameLabel.text = _model.author;
    
    _textLabel1.text = _model.name;
    
    
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    
    _imageView1.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height - 35);
    
    _textLabel1.frame = CGRectMake(0, layoutAttributes.frame.size.height - 35, layoutAttributes.frame.size.width, 35);
    _textLabel1.font = [UIFont systemFontOfSize:14];
    _textLabel1.numberOfLines = 2;
    
    _backImage.frame = CGRectMake(0, layoutAttributes.frame.size.height - 35 - 20, layoutAttributes.frame.size.width, 20);
    _nameLabel.frame = CGRectMake(2, layoutAttributes.frame.size.height - 35 - 17, layoutAttributes.frame.size.width, 20);
    _nameLabel.textColor = [UIColor whiteColor];
    _nameLabel.font = [UIFont systemFontOfSize:12];
}

@end
